Cài SSH Server và fix lỗi SSH Permission denied, please try again

Table of Contents

Cài SSH Server và fix lỗi SSH Permission denied, please try again.

Cài SSH Client và SSH Server

Cài SSH Client

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-client

Cài SSH Server

sudo apt-get update
sudo apt-get upgrade
sudo apt install openssh-server

Start SSH Server

Theo hướng dẫn của người ta thì là vầy

  1. Open your terminal application
  2. Install the openssh-server package on Ubuntu, run: **sudo apt install openssh-server**
  3. Enable ssh server on Ubuntu, run: **sudo systemctl enable ssh**
  4. By default, firewall will block ssh access. Therefore, you must enable ufw and open ssh port
  5. Open ssh tcp port 22 using ufw firewall, run: **sudo ufw allow ssh**
  6. Congratulations. Now you have SSH server installed and running on your Ubuntu server. You can connect to it using ssh client.

Tuy nhiên mình cài cho Ubuntu Docker thì không được, nhưng mình làm như sau thì được :')

cd /etc/init.d/
./ssh start

# Hoặc
sudo service ssh start

image

Fix lỗi SSH Permission denied, please try again.

Lúc mình cài xong SSH Server, mở port ra thì bị đăng nhập không được với tài khoản root, mò một hồi thì sau đây là cách fix lỗi SSH Permission denied, please try again

# Ubuntu 16.x
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

# Ubuntu > 18.04
sed -i 's/#\?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

Tham khảo

  1. https://www.cyberciti.biz/faq/how-to-install-ssh-on-ubuntu-linux-using-apt-get/
  2. https://askubuntu.com/questions/707621/official-docker-image-for-ubuntu-server
  3. https://hub.docker.com/r/dorowu/ubuntu-desktop-lxde-vnc/
  4. https://stackoverflow.com/questions/60833261/cant-ssh-to-dockerubuntu19-04-because-of-happen-permission-denied
  5. https://superuser.com/questions/1562492/cant-ssh-into-docker-container

Leave a Reply

Your email address will not be published. Required fields are marked *